// 获取医院人员，可传入岗位筛选
export function lookup(name) {
  const hisList = JSON.parse(localStorage.HIS_USR_LIST);
  let list = [];
  if (!name) {
    list = hisList;
  } else {
    hisList.forEach(item => {
      if (item.jobTypeString.indexOf(name) > -1) list.push(item);
    });
  }
  return list;
}
// 获取医院人员，可传入职能筛选
export function warehouseList(name) {
  const warehouseList = JSON.parse(localStorage.WARE_HOUSE);
  let list = [];
  if (!name) {
    list = warehouseList;
  } else {
    warehouseList.forEach(item => {
      if (item.grant.indexOf(name) > -1 || item.operatorIds.indexOf(name) > -1) list.push(item);
    });
  }
  return list;
}
// 给table加class
export function tableColor({ row, rowIndex }) {
  // console.log(row, rowIndex);
  if (rowIndex % 2 === 0) {
    return 'warning-row';
  } else if (rowIndex % 2 === 1) {
    return 'success-row';
  }
  return '';
}
// 获取页面高度，处理滚动条
export function labelHeigh(label) {
  const topHeight = (label.offsetHeight + 100 + 28 + 72 + 24);
  const winHeight = document.body.offsetHeight || document.documentElement.offsetHeight;
  const innerHeight = winHeight - topHeight;
  return innerHeight;
}
